package com.dps.recommend.layer.rank;

import com.dps.recommend.ann.LayerAnn;
import com.dps.recommend.beans.DpsRequest;
import com.dps.recommend.beans.ProcessInterface;
import com.dps.recommend.beans.RecItemDps;
import com.dps.recommend.enums.LayerEnum;
import com.dps.recommend.utils.DpsBaseService;
import org.springframework.stereotype.Service;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;


/**
 * 处理综合得到并且按照综合得分排序
 */
@Service
@LayerAnn(layer = LayerEnum.RANK)
class DpsScoreRank extends DpsBaseService implements ProcessInterface {
    @Override
    public <R extends RecItemDps> List doProcess(DpsRequest dpsRequest, List<R> list) {
        list = list.stream().sorted(Comparator.comparing(R::getScore).reversed()).collect(Collectors.toList());
        return list;
    }

}
